<?php
defined('IN_IA') or exit('Access Denied');
global $_GPC, $_W;
$aouthkey = $_GPC['aouthkey'];
$itemid = $_GPC['itemid'];
$itemtitle = $_GPC['itemtitle'];
$orderid = $_GPC['orderid'];
$orderstatus = $_GPC['orderstatus'];
$orderfee = $_GPC['orderfee'];
$shouru_bili = $_GPC['shouru_bili'];
$shouru_yongjin = $_GPC['shouru_yongjin'];
$ctime = $_GPC['ctime'];
$etime = $_GPC['etime'];
$setting = $this->baseset($_W['uniacid']);
$nbkey = $setting['nbkey'];
if ($aouthkey == $nbkey) {
	if (!empty($itemid)) {
	} else {
		exit(json_encode(array('isok' => 'noorderinfo')));
	}
	$list = pdo_fetch("SELECT id,orderid FROM " . tablename($this->tableorder) . " WHERE uniacid = '{$_W['uniacid']}' AND orderid = '{$orderid}'");
	if ($list) {
		$data = array();
		$data['itemid'] = $itemid;
		$data['itemtitle'] = $itemtitle;
		$data['itemid'] = $itemid;
		$data['ctime'] = $ctime;
		$data['etime'] = $etime;
		$data['orderstatus'] = $orderstatus;
		$data['orderfee'] = $orderfee;
		$data['shouru_bili'] = $shouru_bili;
		$data['shouru_yongjin'] = $shouru_yongjin;
		$data['status'] = 1;
		pdo_update($this->tableorder, $data, array('id' => $list['id']));
		exit(json_encode(array('isok' => 1, 'iteminfo' => $list)));
	} else {
		$data = array();
		$data['uniacid'] = $_W['uniacid'];
		$data['itemid'] = $itemid;
		$data['itemtitle'] = $itemtitle;
		$data['itemid'] = $itemid;
		$data['ctime'] = $ctime;
		$data['etime'] = $etime;
		$data['orderid'] = $orderid;
		$data['orderstatus'] = $orderstatus;
		$data['orderfee'] = $orderfee;
		$data['shouru_bili'] = $shouru_bili;
		$data['shouru_yongjin'] = $shouru_yongjin;
		$data['status'] = 1;
		pdo_insert($this->tableorder, $data);
		exit(json_encode(array('isok' => 1, 'iteminfo' => $data)));
	}
} else {
	exit(json_encode(array('isok' => 'aouthkey error!')));
}